// 抽象的动物类
abstract class Animal {
    protected String name;
    protected String species;
    protected String breed;
    protected double price;

    public Animal(String name, String species, String breed, double price) {
        this.name = name;
        this.species = species;
        this.breed = breed;
        this.price = price;
    }

    public abstract void eat();

    public abstract void sleep();

    public abstract void play();

    public abstract void makeSound();
}

// 小猫类
class Cat extends Animal {
    public Cat(String name, String breed, double price) {
        super(name, "Cat", breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing.");
        makeSound(); // 猫在玩的时候会叫
    }

    @Override
    public void makeSound() {
        System.out.println(name + " meows.");
    }
}

// 小狗类
class Dog extends Animal {
    public Dog(String name, String breed, double price) {
        super(name, "Dog", breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing.");
    }

    @Override
    public void makeSound() {
        System.out.println(name + " barks.");
    }
}

// 主类，用于实例化对象并测试
public class Main {
    public static void main(String[] args) {
        // 实例化小猫对象
        Cat cat1 = new Cat("Tom", "Persian", 500);
        Cat cat2 = new Cat("Lily", "British Shorthair", 800);

        // 实例化小狗对象
        Dog dog1 = new Dog("Buddy", "Labrador", 700);
        Dog dog2 = new Dog("Max", "Bulldog", 900);

        // 测试方法
        cat1.eat();
        cat1.sleep();
        cat1.play();

        dog1.eat();
        dog1.sleep();
        dog1.play();
        dog1.makeSound();
    }
}
